home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-1.iso / Files / Bus / A-B / 4D Isbn check.txt.sit / isbn-check.txt
Encoding:
Internet Message Format  |  1994-07-28  |  1018 b   |  [TEXT/MSWD]

  1. From: "Rene G.A. Ros" <rgaros@bio.vu.nl>
  2. Subject: 4D ISBN Check procedure
  3. Date: Thu, 14 Jul 1994 09:08:01 +0200 (MET DST)
  4.  
  5.  
  6. ISBN check proc.txt
  7.  
  8. Small procedure for 4D to check if ISBN book number is correctly
  9. entered.
  10.  
  11. Rene Ros
  12. rgaros@bio.vu.nl
  13.  
  14. Archived as: /info-mac/dev/a4d/isbn-check.txt
  15.  
  16.  
  17. `this procedure determines if the entered ISBN number is valid by
  18.     `checking the checksum of the number
  19. `By doing this you can check if there were no type mismatches.
  20.  
  21. `Ported to 4D by Rene G.A. Ros
  22. `D.C. van Krimpenstraat 3
  23. `1067 SG Amsterdam
  24. `The Netherlands, Europe
  25. `rgaros@bio.vu.nl
  26.  
  27. `result:=ISBN(book nr)
  28. `result is a boolean which is TRUE when the book nr is correct, and FALSE if not.
  29. `book nr is the full ISBN number without dashes and/or spaces
  30.  
  31. `place somewhere else:
  32. `C_STRING("ISBN check";10;$1)
  33. `C_BOOLEAN("ISBN check";$0)
  34.  
  35. C_INTEGER($sum;$i)
  36.  
  37. $sum:=0
  38. For ($i;10;1;-1)
  39.   If ($1Length($1)-$i+1="X"
  40.     $sum:=$sum+($i*10)
  41.   Else 
  42.     $sum:=$sum+($i*Num($1Length($1)-$i+1)
  43.   End if 
  44. End for 
  45. $0:=($sum%11=0)
  46.  
  47.